package com.zz.inventory.feign;

import org.example.dto.StudentInfoDTO;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class StudentFallbackFactory implements FallbackFactory<StudentFeignClient> {
    @Override
    public StudentFeignClient create(Throwable cause) {

        return new StudentFeignClient() {
            @Override
            public StudentInfoDTO getStudentInfo(StudentInfoDTO studentInfoDTo) {
                StudentInfoDTO fallbackDTO = new StudentInfoDTO();
                fallbackDTO.setExamNumber("ERROR-" + System.currentTimeMillis());
                return fallbackDTO;
            }
        };
    }
}
